package cn.chenhuanming.shh.administer.entity.jpa;

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.HashSet;
import java.util.Set;

/**
 * Estate entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "estate", catalog = "house")
public class Estate implements java.io.Serializable {

	// Fields

	private String id;
	private District district;
	private String name;
	private String alias;
	private String provinceName;
	private String cityName;
	private String cityAreaName;
	private String location;
	private LocalDate buildingTime;
	private Float averagePrice;
	private String developer;
	private String developerPhone;
	private Float area;
	private Short volumeRate;
	private Short greenRate;
	private Long totalHouse;
	private Short loop;
	private String propertyCompany;
	private String propertyCompanyPhone;
	private String photo;
	private UserSystem creator;
	private LocalDateTime createTime;
	private String remark;
	private String status;
	private Set<House> houses = new HashSet<House>(0);
	private Set<EstateDetails> estateDetailses = new HashSet<EstateDetails>(0);
	private Set<EstateBroker> estateBrokers = new HashSet<EstateBroker>(0);

	// Constructors

	/** default constructor */
	public Estate() {
	}

	/** minimal constructor */
	public Estate(String id, District district, String name, String location,
			Float averagePrice, String developer, Float area, Short loop,
				  UserSystem creator, LocalDateTime createTime) {
		this.id = id;
		this.district = district;
		this.name = name;
		this.location = location;
		this.averagePrice = averagePrice;
		this.developer = developer;
		this.area = area;
		this.loop = loop;
		this.creator = creator;
		this.createTime = createTime;
	}

	/** full constructor */
	public Estate(String id, District district, String name, String alias,String provinceName,
			String cityName, String cityAreaName, String location,
			LocalDate buildingTime, Float averagePrice, String developer,
			String developerPhone, Float area, Short volumeRate,
			Short greenRate, Long totalHouse, Short loop,
			String propertyCompany, String propertyCompanyPhone, String photo,
				  UserSystem creator, LocalDateTime createTime, String remark,
			String status, Set<House> houses,
			Set<EstateDetails> estateDetailses, Set<EstateBroker> estateBrokers) {
		this.id = id;
		this.district = district;
		this.name = name;
		this.alias = alias;
		this.provinceName = provinceName;
		this.cityName = cityName;
		this.cityAreaName = cityAreaName;
		this.location = location;
		this.buildingTime = buildingTime;
		this.averagePrice = averagePrice;
		this.developer = developer;
		this.developerPhone = developerPhone;
		this.area = area;
		this.volumeRate = volumeRate;
		this.greenRate = greenRate;
		this.totalHouse = totalHouse;
		this.loop = loop;
		this.propertyCompany = propertyCompany;
		this.propertyCompanyPhone = propertyCompanyPhone;
		this.photo = photo;
		this.creator = creator;
		this.createTime = createTime;
		this.remark = remark;
		this.status = status;
		this.houses = houses;
		this.estateDetailses = estateDetailses;
		this.estateBrokers = estateBrokers;
	}

	// Property accessors
	@Id
	@Column(name = "id", unique = true, nullable = false, length = 40)
	@GenericGenerator(name = "uuid16",strategy = "cn.chenhuanming.shh.administer.utils.IDGenerator")
	@GeneratedValue(generator = "uuid16")
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "city_area_id", nullable = false)
	public District getDistrict() {
		return this.district;
	}

	public void setDistrict(District district) {
		this.district = district;
	}

	@Column(name = "name", nullable = false)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "alias")
	public String getAlias() {
		return this.alias;
	}

	public void setAlias(String alias) {
		this.alias = alias;
	}

	@Column(name = "province_name")
	public String getProvinceName() {
		return this.provinceName;
	}

	public void setProvinceName(String provinceName) {
		this.provinceName = provinceName;
	}

	@Column(name = "city_name")
	public String getCityName() {
		return this.cityName;
	}

	public void setCityName(String cityName) {
		this.cityName = cityName;
	}

	@Column(name = "city_area_name")
	public String getCityAreaName() {
		return this.cityAreaName;
	}

	public void setCityAreaName(String cityAreaName) {
		this.cityAreaName = cityAreaName;
	}

	@Column(name = "location", nullable = false)
	public String getLocation() {
		return this.location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	@Column(name = "building_time", length = 19)
	public LocalDate getBuildingTime() {
		return this.buildingTime;
	}

	public void setBuildingTime(LocalDate buildingTime) {
		this.buildingTime = buildingTime;
	}

	@Column(name = "average_price", nullable = false, precision = 10)
	public Float getAveragePrice() {
		return this.averagePrice;
	}

	public void setAveragePrice(Float averagePrice) {
		this.averagePrice = averagePrice;
	}

	@Column(name = "developer", nullable = false)
	public String getDeveloper() {
		return this.developer;
	}

	public void setDeveloper(String developer) {
		this.developer = developer;
	}

	@Column(name = "developer_phone")
	public String getDeveloperPhone() {
		return this.developerPhone;
	}

	public void setDeveloperPhone(String developerPhone) {
		this.developerPhone = developerPhone;
	}

	@Column(name = "area", nullable = false, precision = 255, scale = 0)
	public Float getArea() {
		return this.area;
	}

	public void setArea(Float area) {
		this.area = area;
	}

	@Column(name = "volume_rate")
	public Short getVolumeRate() {
		return this.volumeRate;
	}

	public void setVolumeRate(Short volumeRate) {
		this.volumeRate = volumeRate;
	}

	@Column(name = "green_rate")
	public Short getGreenRate() {
		return this.greenRate;
	}

	public void setGreenRate(Short greenRate) {
		this.greenRate = greenRate;
	}

	@Column(name = "total_house")
	public Long getTotalHouse() {
		return this.totalHouse;
	}

	public void setTotalHouse(Long totalHouse) {
		this.totalHouse = totalHouse;
	}

	@Column(name = "`loop`", nullable = false)
	public Short getLoop() {
		return this.loop;
	}

	public void setLoop(Short loop) {
		this.loop = loop;
	}

	@Column(name = "property_company")
	public String getPropertyCompany() {
		return this.propertyCompany;
	}

	public void setPropertyCompany(String propertyCompany) {
		this.propertyCompany = propertyCompany;
	}

	@Column(name = "property_company_phone")
	public String getPropertyCompanyPhone() {
		return this.propertyCompanyPhone;
	}

	public void setPropertyCompanyPhone(String propertyCompanyPhone) {
		this.propertyCompanyPhone = propertyCompanyPhone;
	}

	@Column(name = "photo")
	public String getPhoto() {
		return this.photo;
	}

	public void setPhoto(String photo) {
		this.photo = photo;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "creator", nullable = false)
	public UserSystem getCreator() {
		return this.creator;
	}

	public void setCreator(UserSystem creator) {
		this.creator = creator;
	}

	@Column(name = "create_time", nullable = false, length = 19)
	public LocalDateTime getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(LocalDateTime createTime) {
		this.createTime = createTime;
	}

	@Column(name = "remark")
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "status", length = 3)
	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "estate")
	public Set<House> getHouses() {
		return this.houses;
	}

	public void setHouses(Set<House> houses) {
		this.houses = houses;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "estate")
	public Set<EstateDetails> getEstateDetailses() {
		return this.estateDetailses;
	}

	public void setEstateDetailses(Set<EstateDetails> estateDetailses) {
		this.estateDetailses = estateDetailses;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "estate")
	public Set<EstateBroker> getEstateBrokers() {
		return this.estateBrokers;
	}

	public void setEstateBrokers(Set<EstateBroker> estateBrokers) {
		this.estateBrokers = estateBrokers;
	}

}